package String案例;

import java.util.Scanner;

public class 登录 {
    public static void main(String[] args) {
        String okUserName="hhh23233333";
        String okPassword="123456";
        Scanner sr=new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入您的账号");
            String userName= sr.next();
            System.out.println("请输入您的密码");
            String password=sr.next();
            if((okUserName.equals(userName)&&okPassword.equals((password)))==true){
                System.out.println("登陆成功!");
                return;
            }else{
                System.out.println("账号或密码错误!您还有"+(2-i)+"次");
            }
        }
        System.out.println("因您多次输入错误请稍后重试!");
    }
}
